package com.lhl.shiro.shiroconfig;

import org.apache.shiro.authc.AuthenticationToken;


/**
 * @author LHL
 * @date 2018/1/8
 */

public class StatelessToken implements AuthenticationToken {
    private static final long serialVersionUID = -8253931312681075249L;
    private String token;
    private String userId;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public StatelessToken() {
    }

    public StatelessToken(String token, String userId) {
        this.token = token;
        this.userId = userId;
    }

    @Override
    public Object getPrincipal() {
        return userId;
    }

    @Override
    public Object getCredentials() {
        return token;
    }

    @Override
    public String toString() {
        return "StatelessToken{" +
                "token='" + token + '\'' +
                ", userId='" + userId + '\'' +
                '}';
    }
}
